{% extends "base.html" %}

{% block title %} {{ submit_type }} Set Term Structure Slope {% endblock %}

{% block head %}
<link rel="stylesheet" href="/css/datepicker.css" type="text/css" />
<script type="text/javascript" src="/javascript/datepicker.js"></script>

{% endblock %}


{% block maincontent %}
    <h1>  {{ submit_type }} Set up Monitoring the Term Structure </h1>
    <form action="" method='post'>

    <input type="hidden" name="term_structure_id"
           value="{{term_structure.name}}" />

    <ul>

{# Begin Error Handling for slope #}
    {% if slope_missing %}
       <li><div role="alert" tabindex="0" class="error">
            Percent contango is missing.</div></li>
    {% elif slope_invalid %}
        <li><div role="alert" tabindex="0" class="error">
            Percent contango is not valid.</div></li>
    {% endif %}

    {% if update_successful %}
        <li><div role="alert" tabindex="0" class="success">
            Term Structure Monitor was updated successfully.</div></li>
    {%  endif %}
{# End error handling for slope #}

    <li class="fields">
        <label class="labelandfield" for="keyword">Contango % </label>
        <input onfocus="show_help_text('slope_help')"
               onblur="clear_help_text('slope_help')"
               type="text" id="slope" name="slope"
               {% if term_structure.slope %}
                   value="{{term_structure.slope}}"
               {% else %}
                   value=""
               {% endif %}
               aria-describedby="slope_help"/> %
        <span id="slope_help" class="help">
            If contango % goes below this, we will sent you an alert. </span>
    </li>


    <li class="fields">
        <label class="labelandfield" for="email_enabled">Enable Email </label>
        <input onfocus="show_help_text('email_enabled_help')"
               onblur="clear_help_text('email_enabled_help')"
               type="checkbox" id="email_enabled" name="email_enabled"
               {% if term_structure.email_enabled or not term_structure%}
                   checked
               {% else %}
               {%  endif %}
               value="email_enabled"
               aria-describedby="email_enabled_help"/>
        <span id="email_enabled_help" class="help">
            To disable alert email, you can un-check this.</span>

    </li>


    </ul>
    <input type="submit" id="next_with_margin"
           name="update_term_structure"
           value="Upate"/>

    </form>

{% endblock %}
